<%@ page import="com.sptpc.exam.Question" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%-- 引入header.jsp --%>
<%@include file="header.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<form method="get" action="score.do">

<%--<%--%>
<%--    List<Question> questions = (List<Question>)session.getAttribute("questions");--%>
<%--    // TODO:  自动生成试卷--%>
<%--    int i = 1;--%>
<%--    for (Question q:questions){--%>
<%--%>--%>
<%--        <%=i%>.<%=q.getQuestion()%><br>--%>
<%--<%--%>
<%--        char opi = 'a';--%>
<%--        for (String op: q.getOptions()){--%>
<%--%>--%>
<%--    <input type="radio" name="<%=q.getId()%>" value="<%=opi %>">--%>
<%--    <%=opi %>.<%=op %><br>--%>
<%--<%--%>
<%--            opi++;--%>
<%--        }--%>
<%--        i++;--%>
<%--    }--%>
<%--%>--%>


<c:forEach items="${sessionScope.questions}" var="q" varStatus="i">
    ${i.count}. ${q.question}<br>
    <c:set var="opis" value='${["a","b","c","d"]}'/>
    <c:forEach items="${q.options}" var="op" varStatus="j">
        <input type="radio" name="${q.id}" value="${opis[j.count - 1]}"/>${opis[j.count - 1]}. ${op}<br>
    </c:forEach>
</c:forEach>
    <input type="submit" value="交卷">

</form>
</body>
</html>
